﻿using System;
using System.Diagnostics;
using UnityEditor;
using UnityEngine;

namespace Inlycat
{
    public class UpdateProtoDll
    {
        [MenuItem("Inlycat/UpdateProtoDll")]
        public static void UpdateDll()
        {
            Process process = new Process();

            try
            {
                //执行bat文件
                LaunchBat(Application.dataPath + "/Inlycat/Plugins/ProtoModule/" + "update_dll.bat");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }


        }

        /// <summary>
        /// 执行bat文件
        /// </summary>
        /// <param name="batName"></param>
        static void LaunchBat(string batName)
        {
            ProcessStartInfo startInfo = new ProcessStartInfo();
            startInfo.CreateNoWindow = true;
            startInfo.FileName = batName;
            startInfo.WindowStyle = ProcessWindowStyle.Maximized;
            Process.Start(startInfo);
        }
    }
}